<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libcoap: encode.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">libcoap<span id="projectnumber">&#160;4.2.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('encode_8c.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">encode.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdio.h&gt;</code><br />
<code>#include &quot;coap_config.h&quot;</code><br />
<code>#include &quot;<a class="el" href="coap_8h_source.html">coap.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="mem_8h_source.html">mem.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="encode_8h_source.html">encode.h</a>&quot;</code><br />
</div>
<p><a href="encode_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a671b4261b2d24de8696258a8efb0f359" id="r_a671b4261b2d24de8696258a8efb0f359"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8c.html#a671b4261b2d24de8696258a8efb0f359">coap_fls</a> (unsigned int i)</td></tr>
<tr class="separator:a671b4261b2d24de8696258a8efb0f359"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5732d87decbffe771159ea02a5e25488" id="r_a5732d87decbffe771159ea02a5e25488"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8c.html#a5732d87decbffe771159ea02a5e25488">coap_flsll</a> (long long i)</td></tr>
<tr class="separator:a5732d87decbffe771159ea02a5e25488"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7d12488893c3062c98bad1f4ab58455c" id="r_a7d12488893c3062c98bad1f4ab58455c"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8c.html#a7d12488893c3062c98bad1f4ab58455c">coap_decode_var_bytes</a> (const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *buf, unsigned int len)</td></tr>
<tr class="memdesc:a7d12488893c3062c98bad1f4ab58455c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Decodes multiple-length byte sequences.  <br /></td></tr>
<tr class="separator:a7d12488893c3062c98bad1f4ab58455c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6987668306bf69553f9b207a624c2d44" id="r_a6987668306bf69553f9b207a624c2d44"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="encode_8c.html#a6987668306bf69553f9b207a624c2d44">coap_encode_var_safe</a> (<a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *buf, size_t length, unsigned int val)</td></tr>
<tr class="memdesc:a6987668306bf69553f9b207a624c2d44"><td class="mdescLeft">&#160;</td><td class="mdescRight">Encodes multiple-length byte sequences.  <br /></td></tr>
<tr class="separator:a6987668306bf69553f9b207a624c2d44"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a7d12488893c3062c98bad1f4ab58455c" name="a7d12488893c3062c98bad1f4ab58455c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7d12488893c3062c98bad1f4ab58455c">&#9670;&#160;</a></span>coap_decode_var_bytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int coap_decode_var_bytes </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Decodes multiple-length byte sequences. </p>
<p><code>buf</code> points to an input byte sequence of length <code>length</code>. Returns the decoded value.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>The input byte sequence to decode from </td></tr>
    <tr><td class="paramname">length</td><td>The length of the input byte sequence</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The decoded value </dd></dl>

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00036">36</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
<a id="a6987668306bf69553f9b207a624c2d44" name="a6987668306bf69553f9b207a624c2d44"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6987668306bf69553f9b207a624c2d44">&#9670;&#160;</a></span>coap_encode_var_safe()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int coap_encode_var_safe </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="uthash_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Encodes multiple-length byte sequences. </p>
<p><code>buf</code> points to an output buffer of sufficient length to store the encoded bytes. <code>value</code> is the value to encode. Returns the number of bytes used to encode <code>value</code> or 0 on error.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>The output buffer to decode into </td></tr>
    <tr><td class="paramname">length</td><td>The output buffer size to encode into (must be sufficient) </td></tr>
    <tr><td class="paramname">value</td><td>The value to encode into the buffer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The number of bytes used to encode <code>value</code> or <code>0</code> on error. </dd></dl>

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00045">45</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
<a id="a671b4261b2d24de8696258a8efb0f359" name="a671b4261b2d24de8696258a8efb0f359"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a671b4261b2d24de8696258a8efb0f359">&#9670;&#160;</a></span>coap_fls()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_fls </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>i</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00020">20</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
<a id="a5732d87decbffe771159ea02a5e25488" name="a5732d87decbffe771159ea02a5e25488"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5732d87decbffe771159ea02a5e25488">&#9670;&#160;</a></span>coap_flsll()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int coap_flsll </td>
          <td>(</td>
          <td class="paramtype">long long&#160;</td>
          <td class="paramname"><em>i</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p class="definition">Definition at line <a class="el" href="encode_8c_source.html#l00026">26</a> of file <a class="el" href="encode_8c_source.html">encode.c</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="encode_8c.html">encode.c</a></li>
    <li class="footer">Generated on Fri Dec 27 2024 09:57:44 for libcoap by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
  </ul>
</div>
</body>
</html>
